package com.heima.wemedia.controller.v1;


import com.heima.model.common.dtos.ResponseResult;
import com.heima.model.wemedia.dtos.WmMaterialDto;
import com.heima.wemedia.service.WmMaterialService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;

@RestController
@Slf4j
@RequestMapping("api/v1/material")
public class WmMaterialController {

    @Autowired
    private WmMaterialService materialService;

    //素材文件上传
    @PostMapping("/upload_picture")
    public ResponseResult upload(@RequestParam("multipartFile") MultipartFile file) {

        log.info("文件上传参数,{}", file);
        return materialService.upload(file);

    }


    //分页查询素材列表
    @PostMapping("list")
    public ResponseResult findList(@RequestBody WmMaterialDto dto){

        return materialService.findAll(dto);
    }


}
